import cooApp, { ui, coolink, Util, cooInfo } from 'coolink-ts'
import pageList from './pages/pageList'

// 注册页面
pageList.registerAllPage();

// flutter 环境准备就绪
cooApp.ready = () => {
    ui.setAppBarHeight(ui.rpx(88));

    coolink.baseinfo.getResourcePath()
        .then((res) => {
            let path = res.path;
            let lastCh = '';
            if (path.length > 0) lastCh = path.substr(-1);
            if (lastCh != '/') path += '/';
            Util.log('mypath = ' + path);
            cooApp.setResourcePath(path);
            if (isTV()) {
                cooApp.pushPage('wheelPage');
                return;
            }
            cooApp.runApp()
            //
        })
}
function isTV() {
    if (cooInfo.infos?.systemInfo?.os && (cooInfo.infos.systemInfo.os.indexOf('ccos') >= 0)) {
        return true;
    }
    return false;
}
